def dfs(depth, weight, cnt):
    # depth：表示第depth个瓜
    # cnt: 表示砍了多少刀

    if weight > m:
        return
    if weight == m:
        global ans
        ans = min(ans, cnt)
    if depth == n:
        return

    # 不买
    dfs(depth + 1, weight + 0, cnt)
    # 买一个
    dfs(depth + 1, weight + A[depth], cnt)
    # 买半个
    dfs(depth + 1, weight + A[depth] // 2, cnt + 1)


n, m = map(int, input().split())
m *= 2
A = list(map(int, input().split()))
A=[x*2 for x in A]
ans = n + 1
dfs(0, 0, 0)
if ans == n + 1:
    ans = -1
print(ans)
